// simple test of google storage functionality

function cancel(e) {
  if (e.preventDefault) {
    e.preventDefault();
  }
  return false;
}

function handleDropEvent (e) {
    // this function handles the file drop...
    if (e.stopPropagation) {
	e.stopPropagation();
    }

    var files = e.dataTransfer.files;
    var output = [];
    for (var i = 0, f; f = files[i]; i++) {
      output.push('<li><strong>', f.name, '</strong> (', f.type || 'n/a', ') - ',
                  f.size, ' bytes, last modified: ',
                  f.lastModifiedDate.toLocaleDateString(), '</li>');
    }

    this.innerHTML += '<p>' + output + '</p>';

    return false;
}

function configurePage() {
    // need to add a handler which figures out what to do when we drop something on the droppable section...
    var drop = document.querySelector('#dropzone');
    
    // Tells the browser that we *can* drop on this target
    addEvent(drop, 'dragover', cancel);
    addEvent(drop, 'dragenter', cancel);
    
    addEvent(drop, 'drop', handleDropEvent ); 
}

function oauthcallback(data) {
    console.log(data);
}

function makeOAuthCall() {
    // So this could start the process of the oauth flow...
    $.ajax( { url: 'https://accounts.google.com/o/oauth2/auth', success: oauthcallback } );
}

